module namelist_mod

  use const_mod, only: r8, inf

  implicit none

  character(256) synop_files(100)
  character(256) raob_files(100)
  character(256) amdar_files(100)
  character(256) profiler_files(100)
  character(256) model_files_t0(100)
  character(256) model_files_tn(100)
  character(256) :: era5_file_tn = ''
  character(256) :: grapes_file_tn = ''
  character(256) obs_impact_file

  logical :: use_synop    = .true.
  logical :: use_raob     = .true.
  logical :: use_amdar    = .true.
  logical :: use_profiler = .true.

  integer ensemble_size
  logical :: parallel_ensemble = .true.

  real(r8) :: omb_ua_limit = inf
  real(r8) :: omb_va_limit = inf
  real(r8) :: omb_ta_limit = inf
  real(r8) :: omb_sh_limit = inf
  real(r8) :: omb_p_limit  = inf

  namelist /efso/        &
    synop_files        , &
    raob_files         , &
    amdar_files        , &
    profiler_files     , &
    model_files_t0     , &
    model_files_tn     , &
    era5_file_tn       , &
    grapes_file_tn     , &
    obs_impact_file    , &
    use_synop          , &
    use_raob           , &
    use_amdar          , &
    use_profiler       , &
    ensemble_size      , &
    parallel_ensemble  , &
    omb_ua_limit       , &
    omb_va_limit       , &
    omb_ta_limit       , &
    omb_sh_limit       , &
    omb_p_limit

contains

  subroutine namelist_init(file_path)

    character(*), intent(in) :: file_path

    open(10, file=file_path, status='old')
    read(10, nml=efso)
    close(10)

  end subroutine namelist_init

end module namelist_mod
